openapi: 3.0.1
info:
  title: LawVu Contracts
  description: Apis for contract resources
  version: '1.0'
servers:
  - url: https://demo.public-api.lawvu.com/contract-apis
paths:
  /v1/contracts/{contractId}/files:
    post:
      tags:
        - ContractFiles
      summary: Upload file
      description: "Add or update a file in a contract. \\\r\n \\\r\nThe body of the request must be content-type 'multipart/form-data' and contain the file data. \\\r\n \\\r\nTo update the contract document: Only specify the 'parentFileId' parameter. The 'folderId' and 'conflictResolution' parameters should not be used for these updates"
      operationId: post-v1-contracts-contractid-files
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The id of the contract
          required: true
          schema:
            type: integer
            description: The id of the contract
            format: int32
        - name: comments
          in: query
          description: Comments to be added to the file
          schema:
            type: string
            description: Comments to be added to the file
            nullable: true
        - name: parentFileId
          in: query
          description: >-
            Format - int32. Creates a new version for the specified parent file
            id
          schema:
            type: integer
            description: Creates a new version for the specified parent file id
            format: int32
            nullable: true
        - name: folderId
          in: query
          description: Format - int32. The id of the folder to upload the file within
          schema:
            type: integer
            description: The id of the folder to upload the file within
            format: int32
            nullable: true
        - name: conflictResolution
          in: query
          description: >-
            Defines behaviour for when a file conflict is
            found<p>Options:</p><ul><li>Replace</li><li>KeepBoth</li><li>SaveVersion</li><li>Skip</li></ul>
          schema:
            enum:
              - Replace
              - KeepBoth
              - SaveVersion
              - Skip
            type: string
            description: >-
              Defines behaviour for when a file conflict is
              found<p>Options:</p><ul><li>Replace</li><li>KeepBoth</li><li>SaveVersion</li><li>Skip</li></ul>
            nullable: true
      requestBody:
        content:
          multipart/form-data:
            schema:
              properties:
                file:
                  type: string
      responses:
        '201':
          description: The id of the created file
          content:
            text/plain:
              schema:
                type: integer
                format: int32
              examples:
                default:
                  value: null
            application/json:
              schema:
                type: integer
                format: int32
              example: 0
            text/json:
              schema:
                type: integer
                format: int32
              example: 0
        '204':
          description: When the file was skipped due to conflict resolution setting
  /v1/contracts:
    post:
      tags:
        - Contracts
      summary: Create contract by upload
      description: >-
        Creates a new contract, with the main contract file being sent in the
        body of the request
      operationId: post-v1-contracts
      requestBody:
        content:
          multipart/form-data:
            schema:
              properties:
                ContractTemplateId:
                  type: integer
                MatterId:
                  type: integer
                ParentContractId:
                  type: integer
                Fields:
                  type: string
                Name:
                  type: string
                ExternalId:
                  type: string
                TeamId:
                  type: integer
                ContractFile:
                  type: string
            example:
              contractTemplateId: 1
              matterId: 321
              parentContractId: 123
              fields: >-
                {"field_1":"field
                1","field_2":123,"field_3":["yes"],"field_4":true}
              name: Test Contract
              externalId: '123'
              teamId: null
              contractFile: null
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: integer
                format: int32
              examples:
                default:
                  value: null
            application/json:
              schema:
                type: integer
                format: int32
              example: 0
            text/json:
              schema:
                type: integer
                format: int32
              example: 0
    get:
      tags:
        - Contracts
      summary: Get contracts
      description: "Gets contracts filtered by single or multiple fields.\r\n<br /> \r\n_To filter by one field_: \"filtering.field\", \"filtering.operator\" and \"filtering.value\" parameters must be filled.\r\n<br /> \r\n_To filter by multiple fields_: \"filtering.logic\" and \"filtering.filters\" parameters must be filled."
      operationId: get-v1-contracts
      parameters:
        - name: skip
          in: query
          description: Format - int32. The number of contracts to skip (used for paging)
          schema:
            type: integer
            description: The number of contracts to skip (used for paging)
            format: int32
        - name: fields
          in: query
          description: Fields to include in the response
          schema:
            type: array
            items:
              type: string
            description: Fields to include in the response
            nullable: true
        - name: filtering.logic
          in: query
          description: >-
            Gets or sets the filtering logic for filters. Value by default is
            'and'<p>Options:</p><ul><li>and</li><li>or</li></ul>
          schema:
            enum:
              - and
              - or
            type: string
            description: >-
              Gets or sets the filtering logic for filters. Value by default is
              'and'<p>Options:</p><ul><li>and</li><li>or</li></ul>
            nullable: true
        - name: filtering.filters
          in: query
          description: "Array of filters object (optional)\r\n<br /> \r\n_Object Properties_:\r\n<br /> \r\n* _Field_: field to filter by\r\n<br /> \r\n* _Operator_: operator used to filter by\r\n<br /> \r\n* _Value_: value to filter by"
          schema:
            $ref: '#/components/schemas/FilteringArray'
        - name: filtering.field
          in: query
          description: Field to filter by (optional)
          schema:
            type: string
            description: Field to filter by (optional)
            nullable: true
        - name: filtering.operator
          in: query
          description: >-
            Operator used for filtering
            (optional)<p>Options:</p><ul><li>eq</li><li>neq</li><li>lt</li><li>lte</li><li>gt</li><li>gte</li><li>startswith</li><li>endswith</li><li>contains</li><li>doesnotcon</li><li>isnull</li></ul>
          schema:
            enum:
              - eq
              - neq
              - lt
              - lte
              - gt
              - gte
              - startswith
              - endswith
              - contains
              - doesnotcon
              - isnull
            type: string
            description: >-
              Operator used for filtering
              (optional)<p>Options:</p><ul><li>eq</li><li>neq</li><li>lt</li><li>lte</li><li>gt</li><li>gte</li><li>startswith</li><li>endswith</li><li>contains</li><li>doesnotcon</li><li>isnull</li></ul>
        - name: filtering.value
          in: query
          description: Value to filter by (optional)
          schema:
            type: string
            description: Value to filter by (optional)
            nullable: true
        - name: sorting.direction
          in: query
          description: >-
            Set the sorting
            direction<p>Options:</p><ul><li>asc</li><li>desc</li></ul>
          schema:
            enum:
              - asc
              - desc
            type: string
            description: >-
              Set the sorting
              direction<p>Options:</p><ul><li>asc</li><li>desc</li></ul>
        - name: sorting.field
          in: query
          description: Set the sorting fields
          schema:
            type: string
            description: Set the sorting fields
            nullable: true
        - name: take
          in: query
          description: >-
            Format - int32. The maximum number of contracts to return<p>Default:
            50</p>
          schema:
            type: integer
            description: The maximum number of contracts to return
            format: int32
            default: 50
        - name: context
          in: query
          description: >-
            Controls the scope of contracts returned by this
            operation<p>Default: Personal</p><p>Options:</p><ul><li>All -
            Returns all contracts regardless of whether the authenticated user
            is a member. Requires the authenticated user to be a member of the
            Contract Administrators security group</li><li>Personal - Returns
            contracts which the authenticated user is a member of. Equivalent to
            the "My contracts" view in LawVu</li><li>Teams - Returns all
            contracts that are accessible by teams that the authenticated user
            is a member of</li><li>Restricted - Returns restricted contracts.
            Requires the authenticated user to be an Organization
            Administrator</li></ul>
          schema:
            enum:
              - All
              - Personal
              - Teams
              - Restricted
            type: string
            description: >-
              Controls the scope of contracts returned by this
              operation<p>Options:</p><ul><li>All - Returns all contracts
              regardless of whether the authenticated user is a member. Requires
              the authenticated user to be a member of the Contract
              Administrators security group</li><li>Personal - Returns contracts
              which the authenticated user is a member of. Equivalent to the "My
              contracts" view in LawVu</li><li>Teams - Returns all contracts
              that are accessible by teams that the authenticated user is a
              member of</li><li>Restricted - Returns restricted contracts.
              Requires the authenticated user to be an Organization
              Administrator</li></ul>
            default: Personal
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/DataSourceResultModel'
              example:
                data:
                  - restricted: false
                    $id: 123
                    name: Example contract
                    onContract: true
                total: 1
            application/json:
              schema:
                $ref: '#/components/schemas/DataSourceResultModel'
              example:
                data:
                  - restricted: false
                    $id: 123
                    name: Example contract
                    onContract: true
                total: 1
            text/json:
              schema:
                $ref: '#/components/schemas/DataSourceResultModel'
              example:
                data:
                  - restricted: false
                    $id: 123
                    name: Example contract
                    onContract: true
                total: 1
  /v1/contracts/quickfind:
    get:
      tags:
        - Contracts
      summary: Find contracts
      description: Quickly find and filter contracts
      operationId: get-v1-contracts-quickfind
      parameters:
        - name: term
          in: query
          description: A term to search contracts by
          schema:
            type: string
            description: A term to search contracts by
            nullable: true
        - name: take
          in: query
          description: >-
            Format - int32. The number of contracts to return (maximum: 100,
            default: 20)
          schema:
            type: integer
            description: 'The number of contracts to return (maximum: 100, default: 20)'
            format: int32
            nullable: true
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/QuickFindContractArray'
              examples:
                default:
                  value: null
            application/json:
              schema:
                $ref: '#/components/schemas/QuickFindContractArray'
              example:
                - id: 0
                  name: string
                  relationship: Master
                  parentId: 0
                  status: Draft
                  ownerFullName: string
            text/json:
              schema:
                $ref: '#/components/schemas/QuickFindContractArray'
              example:
                - id: 0
                  name: string
                  relationship: Master
                  parentId: 0
                  status: Draft
                  ownerFullName: string
  /v1/contracts/recent:
    get:
      tags:
        - Contracts
      summary: Recent  contracts
      description: Returns recently viewed (ref:take) contracts for the user
      operationId: get-v1-contracts-recent
      parameters:
        - name: take
          in: query
          description: >-
            Format - int32. The number of recently viewed contracts to
            return<p>Default: 5</p>
          schema:
            type: integer
            description: The number of recently viewed contracts to return
            format: int32
            default: 5
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/RecentContractArray'
              example:
                - id: 95
                  title: My Contract
                  description: 'Contract ID: 95'
                  name: My Contract
                  matterNumber: LV1234-0012
                  contractStatus: Draft
                  ownerId: 08FD1ED1-627E-4CB9-8388-731227584D21
                  lastActivityDateUtc: '2023-12-15T08:30:00.0000000+00:00'
                - id: 789
                  title: Another Contract
                  description: 'Contract ID: 789'
                  name: Another Contract
                  matterNumber: null
                  contractStatus: Void
                  ownerId: BE17D7D6-721A-4F6D-B081-CAABB6D8F5B9
                  lastActivityDateUtc: '2024-01-12T10:00:00.0000000+00:00'
                - id: 684
                  title: Different Contract
                  description: 'Contract ID: 684'
                  name: Different Contract
                  matterNumber: null
                  contractStatus: Executed
                  ownerId: BE17D7D6-721A-4F6D-B081-CAABB6D8F5B9
                  lastActivityDateUtc: '2023-12-10T03:30:00.0000000+00:00'
            application/json:
              schema:
                $ref: '#/components/schemas/RecentContractArray'
              example:
                - id: 95
                  title: My Contract
                  description: 'Contract ID: 95'
                  name: My Contract
                  matterNumber: LV1234-0012
                  contractStatus: Draft
                  ownerId: 08FD1ED1-627E-4CB9-8388-731227584D21
                  lastActivityDateUtc: '2023-12-15T08:30:00.0000000+00:00'
                - id: 789
                  title: Another Contract
                  description: 'Contract ID: 789'
                  name: Another Contract
                  matterNumber: null
                  contractStatus: Void
                  ownerId: BE17D7D6-721A-4F6D-B081-CAABB6D8F5B9
                  lastActivityDateUtc: '2024-01-12T10:00:00.0000000+00:00'
                - id: 684
                  title: Different Contract
                  description: 'Contract ID: 684'
                  name: Different Contract
                  matterNumber: null
                  contractStatus: Executed
                  ownerId: BE17D7D6-721A-4F6D-B081-CAABB6D8F5B9
                  lastActivityDateUtc: '2023-12-10T03:30:00.0000000+00:00'
            text/json:
              schema:
                $ref: '#/components/schemas/RecentContractArray'
              example:
                - id: 95
                  title: My Contract
                  description: 'Contract ID: 95'
                  name: My Contract
                  matterNumber: LV1234-0012
                  contractStatus: Draft
                  ownerId: 08FD1ED1-627E-4CB9-8388-731227584D21
                  lastActivityDateUtc: '2023-12-15T08:30:00.0000000+00:00'
                - id: 789
                  title: Another Contract
                  description: 'Contract ID: 789'
                  name: Another Contract
                  matterNumber: null
                  contractStatus: Void
                  ownerId: BE17D7D6-721A-4F6D-B081-CAABB6D8F5B9
                  lastActivityDateUtc: '2024-01-12T10:00:00.0000000+00:00'
                - id: 684
                  title: Different Contract
                  description: 'Contract ID: 684'
                  name: Different Contract
                  matterNumber: null
                  contractStatus: Executed
                  ownerId: BE17D7D6-721A-4F6D-B081-CAABB6D8F5B9
                  lastActivityDateUtc: '2023-12-10T03:30:00.0000000+00:00'
  /v1/contractsTemplates:
    get:
      tags:
        - ContractTemplates
      summary: Get contract templates
      description: Gets a list of contract templates
      operationId: get-v1-contractstemplates
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    $ref: '#/components/schemas/ContractTemplate'
              example:
                Parent 1:
                  - id: 1
                    name: Template 1
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
                  - id: 2
                    name: Template 2
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
                Parent 2:
                  - id: 3
                    name: Template 3
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    $ref: '#/components/schemas/ContractTemplate'
              example:
                Parent 1:
                  - id: 1
                    name: Template 1
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
                  - id: 2
                    name: Template 2
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
                Parent 2:
                  - id: 3
                    name: Template 3
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
            text/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    $ref: '#/components/schemas/ContractTemplate'
              example:
                Parent 1:
                  - id: 1
                    name: Template 1
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
                  - id: 2
                    name: Template 2
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
                Parent 2:
                  - id: 3
                    name: Template 3
                    hasWizard: false
                    team: null
                    teamRequired: false
                    hasRules: false
  /v1/contractsTemplates/{templateId}/uploadSchema:
    get:
      tags:
        - ContractTemplates
      summary: Get upload schema
      description: Gets the schema for creating a new contract from file upload
      operationId: get-v1-contractstemplates-templateid-uploadschema
      parameters:
        - name: templateId
          in: path
          description: Format - int32. The ID of the contract template
          required: true
          schema:
            type: integer
            description: The ID of the contract template
            format: int32
      responses:
        '200':
          description: Success
  /v1/contracts/externalid/{externalId}:
    get:
      tags:
        - Contracts
      summary: ExternalId lookup
      description: ExternalId lookup
      operationId: get-v1-contracts-externalid-externalid
      parameters:
        - name: externalId
          in: path
          description: The externalId to lookup
          required: true
          schema:
            type: string
            description: The externalId to lookup
            nullable: true
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ExternalIdLookupModel'
              examples:
                default:
                  value: null
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalIdLookupModel'
              example:
                id: 0
            text/json:
              schema:
                $ref: '#/components/schemas/ExternalIdLookupModel'
              example:
                id: 0
  /v1/contracts/{contractId}:
    patch:
      tags:
        - Contracts
      summary: Update contract
      description: Update contract
      operationId: patch-v1-contracts-contractid
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The Id of the contract
          required: true
          schema:
            type: integer
            description: The Id of the contract
            format: int32
      requestBody:
        description: The update request (in jsonpatch format)
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            example:
              - value: '123'
                path: ExternalId
                op: replace
          application/json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            example:
              - value: '123'
                path: ExternalId
                op: replace
          text/json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            example:
              - value: '123'
                path: ExternalId
                op: replace
          application/*+json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            example:
              - value: '123'
                path: ExternalId
                op: replace
      responses:
        '200':
          description: Success
    get:
      tags:
        - Contracts
      summary: Get contract
      description: Get contract details by contract id
      operationId: get-v1-contracts-contractid
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The Id of the contract
          required: true
          schema:
            type: integer
            description: The Id of the contract
            format: int32
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContractDetails'
              examples:
                default:
                  value: null
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetails'
              example:
                id: 0
                name: string
                status: Draft
                category: Sales
                templateId: 0
                templateName: string
                typeName: string
                createdBy: string
                createdByUserId: string
                ownerId: string
                matterId: 0
                matterName: string
                matterNumber: string
                createdDateUtc: string
                restricted: true
                hasSow: true
                parentContractId: 0
                documentFileId: 0
                parentIsRestricted: true
                onContract: true
                onMatter: true
                contractSpecificEmail: string
                expiry: string
                teamId: 0
                externalId: string
                lastStatusMessage:
                  message: string
                  createdDateUtc: string
                  userId: string
                  userFirstname: string
                  userLastname: string
                  userOrganisationId: 0
                  userOrganisationName: string
                  userHasPicture: true
                  userPictureCacheId: 0
                  userFullName: string
                  userInitials: string
                  userOrganisationHasLogo: true
                  userOrganisationPictureCacheId: 0
                owner:
                  userId: string
                  userFirstname: string
                  userLastname: string
                  userOrganisationId: 0
                  userOrganisationName: string
                  userHasPicture: true
                  userPictureCacheId: 0
                  userFullName: string
                  userInitials: string
                executedDateUtc: string
            text/json:
              schema:
                $ref: '#/components/schemas/ContractDetails'
              example:
                id: 0
                name: string
                status: Draft
                category: Sales
                templateId: 0
                templateName: string
                typeName: string
                createdBy: string
                createdByUserId: string
                ownerId: string
                matterId: 0
                matterName: string
                matterNumber: string
                createdDateUtc: string
                restricted: true
                hasSow: true
                parentContractId: 0
                documentFileId: 0
                parentIsRestricted: true
                onContract: true
                onMatter: true
                contractSpecificEmail: string
                expiry: string
                teamId: 0
                externalId: string
                lastStatusMessage:
                  message: string
                  createdDateUtc: string
                  userId: string
                  userFirstname: string
                  userLastname: string
                  userOrganisationId: 0
                  userOrganisationName: string
                  userHasPicture: true
                  userPictureCacheId: 0
                  userFullName: string
                  userInitials: string
                  userOrganisationHasLogo: true
                  userOrganisationPictureCacheId: 0
                owner:
                  userId: string
                  userFirstname: string
                  userLastname: string
                  userOrganisationId: 0
                  userOrganisationName: string
                  userHasPicture: true
                  userPictureCacheId: 0
                  userFullName: string
                  userInitials: string
                executedDateUtc: string
  /v1/contracts/{contractId}/fields:
    get:
      tags:
        - Contracts
      summary: Get contract fields
      description: Get contract fields by contract id
      operationId: get-v1-contracts-contractid-fields
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The Id of the contract
          required: true
          schema:
            type: integer
            description: The Id of the contract
            format: int32
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContractFieldData'
              example:
                detailFields:
                  schema:
                    properties:
                      field_1:
                        fieldId: 1
                        title: An example field name
                        description: Example field description
                        lawvuType: 7
                        isReadOnly: false
                        type: boolean
                        label: ''
                    order:
                      - field_1
                    required:
                      - field_1
                  model:
                    field_1: true
                coreFields:
                  schema: null
                  model: null
            application/json:
              schema:
                $ref: '#/components/schemas/ContractFieldData'
              example:
                detailFields:
                  schema:
                    properties:
                      field_1:
                        fieldId: 1
                        title: An example field name
                        description: Example field description
                        lawvuType: 7
                        isReadOnly: false
                        type: boolean
                        label: ''
                    order:
                      - field_1
                    required:
                      - field_1
                  model:
                    field_1: true
                coreFields:
                  schema: null
                  model: null
            text/json:
              schema:
                $ref: '#/components/schemas/ContractFieldData'
              example:
                detailFields:
                  schema:
                    properties:
                      field_1:
                        fieldId: 1
                        title: An example field name
                        description: Example field description
                        lawvuType: 7
                        isReadOnly: false
                        type: boolean
                        label: ''
                    order:
                      - field_1
                    required:
                      - field_1
                  model:
                    field_1: true
                coreFields:
                  schema: null
                  model: null
    patch:
      tags:
        - Contracts
      summary: Update fields
      description: Update fields
      operationId: patch-v1-contracts-contractid-fields
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The Id of the contract
          required: true
          schema:
            type: integer
            description: The Id of the contract
            format: int32
      requestBody:
        description: The update request (in jsonpatch format)
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            examples:
              string field:
                value:
                  value: new value
                  path: /field_string
                  op: replace
              number field:
                value:
                  value: 123
                  path: /field_number
                  op: replace
              date field:
                value:
                  value: '2022-03-03T12:00:00.0000000+00:00'
                  path: /field_date
                  op: replace
              boolean field:
                value:
                  value: true
                  path: /field_bool
                  op: replace
              object field:
                value:
                  value:
                    id: object_id
                  path: /field_object
                  op: replace
              array field:
                value:
                  value:
                    - 1
                    - 2
                    - 3
                  path: /field_array
                  op: replace
              group field:
                value:
                  value: string under a group
                  path: /group1/field_string
                  op: replace
              nested group field:
                value:
                  value: string under multiple groups
                  path: /group1/group2/group3/field_string
                  op: replace
          application/json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            examples:
              string field:
                value:
                  value: new value
                  path: /field_string
                  op: replace
              number field:
                value:
                  value: 123
                  path: /field_number
                  op: replace
              date field:
                value:
                  value: '2022-03-03T12:00:00.0000000+00:00'
                  path: /field_date
                  op: replace
              boolean field:
                value:
                  value: true
                  path: /field_bool
                  op: replace
              object field:
                value:
                  value:
                    id: object_id
                  path: /field_object
                  op: replace
              array field:
                value:
                  value:
                    - 1
                    - 2
                    - 3
                  path: /field_array
                  op: replace
              group field:
                value:
                  value: string under a group
                  path: /group1/field_string
                  op: replace
              nested group field:
                value:
                  value: string under multiple groups
                  path: /group1/group2/group3/field_string
                  op: replace
          text/json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            examples:
              string field:
                value:
                  value: new value
                  path: /field_string
                  op: replace
              number field:
                value:
                  value: 123
                  path: /field_number
                  op: replace
              date field:
                value:
                  value: '2022-03-03T12:00:00.0000000+00:00'
                  path: /field_date
                  op: replace
              boolean field:
                value:
                  value: true
                  path: /field_bool
                  op: replace
              object field:
                value:
                  value:
                    id: object_id
                  path: /field_object
                  op: replace
              array field:
                value:
                  value:
                    - 1
                    - 2
                    - 3
                  path: /field_array
                  op: replace
              group field:
                value:
                  value: string under a group
                  path: /group1/field_string
                  op: replace
              nested group field:
                value:
                  value: string under multiple groups
                  path: /group1/group2/group3/field_string
                  op: replace
          application/*+json:
            schema:
              $ref: '#/components/schemas/OperationArray'
            examples:
              string field:
                value:
                  value: new value
                  path: /field_string
                  op: replace
              number field:
                value:
                  value: 123
                  path: /field_number
                  op: replace
              date field:
                value:
                  value: '2022-03-03T12:00:00.0000000+00:00'
                  path: /field_date
                  op: replace
              boolean field:
                value:
                  value: true
                  path: /field_bool
                  op: replace
              object field:
                value:
                  value:
                    id: object_id
                  path: /field_object
                  op: replace
              array field:
                value:
                  value:
                    - 1
                    - 2
                    - 3
                  path: /field_array
                  op: replace
              group field:
                value:
                  value: string under a group
                  path: /group1/field_string
                  op: replace
              nested group field:
                value:
                  value: string under multiple groups
                  path: /group1/group2/group3/field_string
                  op: replace
      responses:
        '200':
          description: Success
  /v1/contracts/wizard:
    post:
      tags:
        - Contracts
      summary: Create contract
      description: Creates a new contract, using the contract template wizard
      operationId: post-v1-contracts-wizard
      requestBody:
        description: Details of the contract to be created
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/CreateContract'
            example:
              contractTemplateId: 1
              matterId: 321
              parentContractId: 123
              fields: >-
                {"field_1":"field
                1","field_2":123,"field_3":["yes"],"field_4":true}
              name: Test Contract
              externalId: '123'
              teamId: null
              contractFile: null
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContract'
            example:
              contractTemplateId: 1
              matterId: 321
              parentContractId: 123
              fields: >-
                {"field_1":"field
                1","field_2":123,"field_3":["yes"],"field_4":true}
              name: Test Contract
              externalId: '123'
              teamId: null
              contractFile: null
          text/json:
            schema:
              $ref: '#/components/schemas/CreateContract'
            example:
              contractTemplateId: 1
              matterId: 321
              parentContractId: 123
              fields: >-
                {"field_1":"field
                1","field_2":123,"field_3":["yes"],"field_4":true}
              name: Test Contract
              externalId: '123'
              teamId: null
              contractFile: null
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateContract'
            example:
              contractTemplateId: 1
              matterId: 321
              parentContractId: 123
              fields: >-
                {"field_1":"field
                1","field_2":123,"field_3":["yes"],"field_4":true}
              name: Test Contract
              externalId: '123'
              teamId: null
              contractFile: null
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: integer
                format: int32
              examples:
                default:
                  value: null
            application/json:
              schema:
                type: integer
                format: int32
              example: 0
            text/json:
              schema:
                type: integer
                format: int32
              example: 0
  /v1/contracts/entities:
    get:
      tags:
        - Contracts
      summary: Contract entities
      description: Gets contract entities (other parties)
      operationId: get-v1-contracts-entities
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContractEntityArray'
              example:
                - id: 1
                  name: Entity 1
                - id: 2
                  name: Entity 2
            application/json:
              schema:
                $ref: '#/components/schemas/ContractEntityArray'
              example:
                - id: 1
                  name: Entity 1
                - id: 2
                  name: Entity 2
            text/json:
              schema:
                $ref: '#/components/schemas/ContractEntityArray'
              example:
                - id: 1
                  name: Entity 1
                - id: 2
                  name: Entity 2
    post:
      tags:
        - Contracts
      summary: Create contract entity
      description: Creates a contract entity
      operationId: post-v1-contracts-entities
      requestBody:
        content:
          application/json-patch+json:
            schema:
              type: string
              nullable: true
            example: string
          application/json:
            schema:
              type: string
              nullable: true
            example: string
          text/json:
            schema:
              type: string
              nullable: true
            example: string
          application/*+json:
            schema:
              type: string
              nullable: true
            example: string
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: integer
                format: int32
              examples:
                default:
                  value: null
            application/json:
              schema:
                type: integer
                format: int32
              example: 0
            text/json:
              schema:
                type: integer
                format: int32
              example: 0
  /v1/contracts/{contractId}/statusMessages:
    post:
      tags:
        - ContractStatusMessage
      summary: Add a status message to a contract
      description: Add status message to a contract
      operationId: post-v1-contracts-contractid-statusmessages
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The Id of the contract
          required: true
          schema:
            type: integer
            description: The Id of the contract
            format: int32
      requestBody:
        description: The status message to add
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/ContractStatusMessageModel'
            example:
              StatusMessage: Test status message
          application/json:
            schema:
              $ref: '#/components/schemas/ContractStatusMessageModel'
            example:
              StatusMessage: Test status message
          text/json:
            schema:
              $ref: '#/components/schemas/ContractStatusMessageModel'
            example:
              StatusMessage: Test status message
          application/*+json:
            schema:
              $ref: '#/components/schemas/ContractStatusMessageModel'
            example:
              StatusMessage: Test status message
      responses:
        '204':
          description: Success
  /v1/contracts/{contractId}/users:
    post:
      tags:
        - ContractUser
      summary: Add user to a contract
      description: Adds a user to a contract as a member
      operationId: post-v1-contracts-contractid-users
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The ID of the contract
          required: true
          schema:
            type: integer
            description: The ID of the contract
            format: int32
      requestBody:
        description: The ID of the user to add into a contract
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/AssignContractUser'
            example:
              UserId: User id test
          application/json:
            schema:
              $ref: '#/components/schemas/AssignContractUser'
            example:
              UserId: User id test
          text/json:
            schema:
              $ref: '#/components/schemas/AssignContractUser'
            example:
              UserId: User id test
          application/*+json:
            schema:
              $ref: '#/components/schemas/AssignContractUser'
            example:
              UserId: User id test
      responses:
        '204':
          description: Success
    get:
      tags:
        - ContractUser
      summary: Get contract users
      description: Returns the users that are assigned to the contract
      operationId: get-v1-contracts-contractid-users
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The contract id
          required: true
          schema:
            type: integer
            description: The contract id
            format: int32
        - name: skip
          in: query
          description: Format - int32. The number of results to skip
          schema:
            type: integer
            description: The number of results to skip
            format: int32
        - name: filtering.field
          in: query
          description: Field to filter by (optional)
          schema:
            type: string
            description: Field to filter by (optional)
            nullable: true
        - name: filtering.operator
          in: query
          description: >-
            Operator used for filtering
            (optional)<p>Options:</p><ul><li>eq</li><li>neq</li><li>lt</li><li>lte</li><li>gt</li><li>gte</li><li>startswith</li><li>endswith</li><li>contains</li><li>doesnotcon</li><li>isnull</li></ul>
          schema:
            enum:
              - eq
              - neq
              - lt
              - lte
              - gt
              - gte
              - startswith
              - endswith
              - contains
              - doesnotcon
              - isnull
            type: string
            description: >-
              Operator used for filtering
              (optional)<p>Options:</p><ul><li>eq</li><li>neq</li><li>lt</li><li>lte</li><li>gt</li><li>gte</li><li>startswith</li><li>endswith</li><li>contains</li><li>doesnotcon</li><li>isnull</li></ul>
        - name: filtering.value
          in: query
          description: Value to filter by (optional)
          schema:
            type: string
            description: Value to filter by (optional)
            nullable: true
        - name: sorting.direction
          in: query
          description: >-
            Set the sorting
            direction<p>Options:</p><ul><li>asc</li><li>desc</li></ul>
          schema:
            enum:
              - asc
              - desc
            type: string
            description: >-
              Set the sorting
              direction<p>Options:</p><ul><li>asc</li><li>desc</li></ul>
        - name: sorting.field
          in: query
          description: Set the sorting fields
          schema:
            type: string
            description: Set the sorting fields
            nullable: true
        - name: take
          in: query
          description: >-
            Format - int32. The maximum number of contract users to
            return<p>Default: 50</p>
          schema:
            type: integer
            description: The maximum number of contract users to return
            format: int32
            default: 50
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContractUserDataSourceResult'
              examples:
                default:
                  value: null
            application/json:
              schema:
                $ref: '#/components/schemas/ContractUserDataSourceResult'
              example:
                data:
                  - userId: string
                    userFirstname: string
                    userLastname: string
                    userOrganisationId: 0
                    userOrganisationName: string
                    userHasPicture: true
                    userPictureCacheId: 0
                    userFullName: string
                    userInitials: string
                total: 0
            text/json:
              schema:
                $ref: '#/components/schemas/ContractUserDataSourceResult'
              example:
                data:
                  - userId: string
                    userFirstname: string
                    userLastname: string
                    userOrganisationId: 0
                    userOrganisationName: string
                    userHasPicture: true
                    userPictureCacheId: 0
                    userFullName: string
                    userInitials: string
                total: 0
  /v1/contracts/{contractId}/keyDates:
    get:
      tags:
        - ContractKeyDate
      summary: Get contract key dates
      description: Returns a list of contract key dates
      operationId: get-v1-contracts-contractid-keydates
      parameters:
        - name: contractId
          in: path
          description: Format - int32. The contract id
          required: true
          schema:
            type: integer
            description: The contract id
            format: int32
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContractKeyDateModelArray'
              example:
                - id: 1
                  date: '2020-01-01'
                  name: Key date 1
                  value: 1
                - id: 2
                  date: '2020-01-02'
                  name: Key date 2
                  value: 2
            application/json:
              schema:
                $ref: '#/components/schemas/ContractKeyDateModelArray'
              example:
                - id: 1
                  date: '2020-01-01'
                  name: Key date 1
                  value: 1
                - id: 2
                  date: '2020-01-02'
                  name: Key date 2
                  value: 2
            text/json:
              schema:
                $ref: '#/components/schemas/ContractKeyDateModelArray'
              example:
                - id: 1
                  date: '2020-01-01'
                  name: Key date 1
                  value: 1
                - id: 2
                  date: '2020-01-02'
                  name: Key date 2
                  value: 2
components:
  schemas:
    ContractKeyDateModel:
      type: object
      properties:
        id:
          type: integer
          format: int32
        date:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        value:
          type: number
          format: double
      additionalProperties: false
    ContractKeyDateModelArray:
      type: array
      items:
        $ref: '#/components/schemas/ContractKeyDateModel'
    Filtering:
      type: object
      properties:
        field:
          type: string
          description: Field to filter by (optional)
          nullable: true
        operator:
          enum:
            - eq
            - neq
            - lt
            - lte
            - gt
            - gte
            - startswith
            - endswith
            - contains
            - doesnotcon
            - isnull
          type: string
          description: >-
            Operator used for filtering
            (optional)<p>Options:</p><ul><li>eq</li><li>neq</li><li>lt</li><li>lte</li><li>gt</li><li>gte</li><li>startswith</li><li>endswith</li><li>contains</li><li>doesnotcon</li><li>isnull</li></ul>
        value:
          type: string
          description: Value to filter by (optional)
          nullable: true
      additionalProperties: false
    FilteringArray:
      type: array
      items:
        $ref: '#/components/schemas/Filtering'
    DataSourceResultModel:
      type: object
      properties:
        data:
          type: object
          description: Represents a single page of processed data.
          nullable: true
        total:
          type: integer
          description: The total number of records available.
          format: int64
      additionalProperties: false
    QuickFindContract:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          nullable: true
        relationship:
          enum:
            - Master
            - StatementOfWork
            - Amendment
          type: string
          description: >-
            <p>Options:</p><ul><li>Master</li><li>StatementOfWork</li><li>Amendment</li></ul>
        parentId:
          type: integer
          format: int32
          nullable: true
        status:
          enum:
            - Draft
            - Negotiating
            - Approval
            - Signing
            - Executed
            - Expired
            - Void
          type: string
          description: >-
            <p>Options:</p><ul><li>Draft</li><li>Negotiating</li><li>Approval</li><li>Signing</li><li>Executed</li><li>Expired</li><li>Void</li></ul>
        ownerFullName:
          type: string
          nullable: true
      additionalProperties: false
    QuickFindContractArray:
      type: array
      items:
        $ref: '#/components/schemas/QuickFindContract'
    RecentContract:
      type: object
      properties:
        id:
          type: integer
          format: int32
        title:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        matterNumber:
          type: string
          nullable: true
        contractStatus:
          enum:
            - Draft
            - Negotiating
            - Approval
            - Signing
            - Executed
            - Expired
            - Void
          type: string
          description: >-
            <p>Options:</p><ul><li>Draft</li><li>Negotiating</li><li>Approval</li><li>Signing</li><li>Executed</li><li>Expired</li><li>Void</li></ul>
        ownerId:
          type: string
          nullable: true
        lastActivityDateUtc:
          type: string
          description: The UTC date of when the current user last viewed the Contract
          format: date-time
          nullable: true
      additionalProperties: false
    RecentContractArray:
      type: array
      items:
        $ref: '#/components/schemas/RecentContract'
    ContractEntity:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          nullable: true
      additionalProperties: false
    ContractEntityArray:
      type: array
      items:
        $ref: '#/components/schemas/ContractEntity'
    ExternalIdLookupModel:
      type: object
      properties:
        id:
          type: integer
          format: int32
      additionalProperties: false
    Operation:
      type: object
      properties:
        value:
          type: object
          nullable: true
        path:
          type: string
          nullable: true
        op:
          type: string
          nullable: true
        from:
          type: string
          nullable: true
      additionalProperties: false
    OperationArray:
      type: array
      items:
        $ref: '#/components/schemas/Operation'
    StatusMessage:
      type: object
      properties:
        message:
          type: string
          nullable: true
        createdDateUtc:
          type: string
          format: date-time
        userId:
          type: string
          nullable: true
        userFirstname:
          type: string
          nullable: true
        userLastname:
          type: string
          nullable: true
        userOrganisationId:
          type: integer
          format: int32
          nullable: true
        userOrganisationName:
          type: string
          nullable: true
        userHasPicture:
          type: boolean
        userPictureCacheId:
          type: integer
          format: int32
        userFullName:
          type: string
          nullable: true
        userInitials:
          type: string
          nullable: true
        userOrganisationHasLogo:
          type: boolean
        userOrganisationPictureCacheId:
          type: integer
          format: int32
          nullable: true
      additionalProperties: false
    ContractUser:
      type: object
      properties:
        userId:
          type: string
          nullable: true
        userFirstname:
          type: string
          nullable: true
        userLastname:
          type: string
          nullable: true
        userOrganisationId:
          type: integer
          format: int32
          nullable: true
        userOrganisationName:
          type: string
          nullable: true
        userHasPicture:
          type: boolean
        userPictureCacheId:
          type: integer
          format: int32
        userFullName:
          type: string
          nullable: true
        userInitials:
          type: string
          nullable: true
      additionalProperties: false
    ContractDetails:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          nullable: true
        status:
          enum:
            - Draft
            - Negotiating
            - Approval
            - Signing
            - Executed
            - Expired
            - Void
          type: string
          description: >-
            <p>Options:</p><ul><li>Draft</li><li>Negotiating</li><li>Approval</li><li>Signing</li><li>Executed</li><li>Expired</li><li>Void</li></ul>
        category:
          enum:
            - Sales
            - Purchasing
            - Commercial
          type: string
          description: >-
            <p>Options:</p><ul><li>Sales</li><li>Purchasing</li><li>Commercial</li></ul>
        templateId:
          type: integer
          format: int32
        templateName:
          type: string
          nullable: true
        typeName:
          type: string
          nullable: true
        createdBy:
          type: string
          nullable: true
        createdByUserId:
          type: string
          nullable: true
        ownerId:
          type: string
          nullable: true
        matterId:
          type: integer
          format: int32
          nullable: true
        matterName:
          type: string
          nullable: true
        matterNumber:
          type: string
          nullable: true
        createdDateUtc:
          type: string
          format: date-time
        restricted:
          type: boolean
        hasSow:
          type: boolean
        parentContractId:
          type: integer
          format: int32
          nullable: true
        documentFileId:
          type: integer
          format: int32
          nullable: true
        parentIsRestricted:
          type: boolean
        onContract:
          type: boolean
        onMatter:
          type: boolean
        contractSpecificEmail:
          type: string
          nullable: true
        expiry:
          type: string
          format: date-time
          nullable: true
        teamId:
          type: integer
          format: int32
          nullable: true
        externalId:
          type: string
          nullable: true
        lastStatusMessage:
          $ref: '#/components/schemas/StatusMessage'
        owner:
          $ref: '#/components/schemas/ContractUser'
        executedDateUtc:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
    FieldData:
      type: object
      properties:
        schema:
          type: object
          nullable: true
        model:
          type: object
          nullable: true
      additionalProperties: false
    ContractFieldData:
      type: object
      properties:
        detailFields:
          $ref: '#/components/schemas/FieldData'
        coreFields:
          $ref: '#/components/schemas/FieldData'
      additionalProperties: false
    CreateContract:
      required:
        - contractTemplateId
        - name
      type: object
      properties:
        contractTemplateId:
          type: integer
          description: The template for the category
          format: int32
        matterId:
          type: integer
          description: Optionally set the parent matter id
          format: int32
          nullable: true
        parentContractId:
          type: integer
          description: Optionally set the parent contract id
          format: int32
          nullable: true
        fields:
          type: string
          description: The fields (from contract template) for the contract
          nullable: true
        name:
          type: string
          description: The contract name
        externalId:
          type: string
          description: >-
            Optionally set an ID from an external system. Uniqueness is enforced
            for your organisation
          nullable: true
        teamId:
          type: integer
          description: >-
            Assigns a team to the contract. This can be required [ref:
            contractTemplate: TeamRequired]
          format: int32
          nullable: true
        contractFile:
          type: string
          format: binary
          nullable: true
      additionalProperties: false
    ContractStatusMessageModel:
      required:
        - statusMessage
      type: object
      properties:
        statusMessage:
          type: string
      additionalProperties: false
    Team:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
      additionalProperties: false
    ContractTemplate:
      type: object
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          nullable: true
        hasWizard:
          type: boolean
        team:
          $ref: '#/components/schemas/Team'
        teamRequired:
          type: boolean
        hasRules:
          type: boolean
      additionalProperties: false
    AssignContractUser:
      required:
        - userId
      type: object
      properties:
        userId:
          type: string
      additionalProperties: false
    ContractUserDataSourceResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ContractUser'
          description: Represents a single page of processed data.
          nullable: true
        total:
          type: integer
          description: The total number of records available.
          format: int32
      additionalProperties: false
